package cn.wolfcode.luowowo.common.query;

import lombok.Getter;
import lombok.Setter;

@Setter@Getter
public class TravelQuery extends QueryObject {
    private int state = -1;
    private Long destId;
    private int orderType;
    private int travelTimeType;
    private int perExpendType;
    private int dayType;

    //因为orderType只有最新和最热,就直接覆写getter方法
    public String getOrderBy(){
        return orderType == 1 ? "t.releaseTime DESC" : "t.viewnum DESC";
    }
    //重写其余的getter方法
    public TravelCondition getTravelTimeType(){
        return TravelCondition.TRAVEL_TIME.get(travelTimeType);
    }
    public TravelCondition getPerExpendType(){
        return TravelCondition.TRAVEL_PER_EXPEND.get(perExpendType);
    }
    public TravelCondition getDayType(){
        return TravelCondition.TRAVEL_TIME.get(dayType);
    }
}
